#include<iostream>
#include<string> 
#include<cstring>

using namespace std;

void clearString(string & t)
{
	t.clear();
}

int main(void)
{
	string ballon[1000],temp;
	int number[1000];
	int count = 0;
	int n,i,j;
	cin >> n;
	while(n!=0)
	{
		//memset(ballon,0,sizeof(ballon));
		//for_each()
		memset(number,0,sizeof(number));
		count = 0;
		
		for(i=0;i<n;i++)
		{
			temp = '\0';
			cin >> temp;
			for(j=0;j<count;j++)
			{
				if(temp==ballon[j])  break;
			}
			if(count==j) 
			{
				ballon[count] = temp;
				number[count] = 1;
				count++;
			}
			else
			{
				number[j]++;
			}
		}
		
		j = 0;
		for(i=1;i<count;i++)
		{
			if(number[j] < number[i])  j=i;
		}
		cout << ballon[j] <<endl;
		cin >> n;
	}

	
}
